@model FunnelWeb.Web.Areas.Admin.Views.Upload.IndexModel
@{
    ViewBag.Title = "Uploads";
  Layout = "~/Areas/Admin/Views/Shared/_Private.cshtml";
}

<h2>
  Directory Listing: 
  @foreach (var part in ViewData.Model.Path) {
    <text>/</text> @Html.ActionLink(part.Name, "Index", new { Area = "Admin", path = part.Path })
  }
</h2>

<div>
  <table>
    <thead>
      <tr>
        <td></td>
        <td style="min-width: 300px">Name</td>
        <td>Extension</td>
        <td>Size</td>
        <td>Modified</td>
        <td>Actions</td>
      </tr>
    </thead>
        
    @foreach (var item in ViewData.Model.Items)
    {
    <tr>
      <td><img width="16" height="16" src="/Content/Images/FileTypes/@item.Image" alt="@item.Extension" /></td>
      <td class="firstcolumn">
      @if (item.IsDirectory)
      {
        @Html.ActionLink(item.Name, "Index", new { Area = "Admin", path = item.Path })
       }
      else
      {
        @Html.ActionLink(item.Name, "Render", new { Area = "Admin", path = item.Path })
      }
      </td>
      <td>@item.Extension</td>
      <td class="numeric">@item.FileSize</td>
      <td class="date">@item.Modified</td>
      <td>
        @Html.ActionLink("Delete", "Delete", new { Area = "Admin", path = Model.PathString, filePath = item.Path, })
      </td>
    </tr>
    }
  </table>
</div>
    
<div>
<h2>Upload</h2>
    
@using (Html.BeginForm("Upload", "Upload", FormMethod.Post, new { Area = "Admin", enctype = "multipart/form-data" }))
{
  <input type="hidden" name="path" value="@Model.PathString" />
  <input type="file" name="upload" />
  <input type="checkbox" name="unzip" id="unzip" title="unzip" value="true" /> <label for="unzip">unzip</label>
  <input type="submit" value="Submit" />
}
</div>
    
<h2>Create Directory</h2>
    
@using (Html.BeginForm("CreateDirectory", "Upload", FormMethod.Post, new { Area = "Admin", enctype = "multipart/form-data" }))
{
  <input type="hidden" name="path" value="@Model.PathString" />
  <input type="text" name="name" />
  <input type="submit" value="Submit" />
}
    
